package com.kgc.good.goodmanagerservice.service;

import com.kgc.good.bean.Goods;
import com.kgc.good.bean.GoodsExample;
import com.kgc.good.goodmanagerservice.mapper.GoodsMapper;
import com.kgc.good.service.GoodsService;
import org.apache.dubbo.config.annotation.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Resource
    GoodsMapper goodsMapper;
    @Override
    public List<Goods> getGoodsByAddress(Integer id) {
        GoodsExample example=new GoodsExample();
        GoodsExample.Criteria criteria = example.createCriteria();
        criteria.andDistrictEqualTo(id);
        List<Goods> goods = goodsMapper.selectByExample(example);
        return goods;
    }

    @Override
    public Goods getById(Integer id) {
        return goodsMapper.selectByPrimaryKey(id);
    }

    @Override
    public Integer upGoods(Goods goods) {
        return goodsMapper.updateByPrimaryKeySelective(goods);
    }
}
